import requests from "./requests";
// let getNavBar = async () => await requests.get('/navbar');
// 登录
let goLogin = (username, password) => requests.post('/user/login', { phone: username, passWord: password });
// 注册
let goRegister = (phone, userName, passWord) => requests.post('/user/register', { phone, userName, passWord });
// 查询个人信息
let getUserInfoApi = (id) => requests.post('/user/query_user_info', { id });


// 课程查询接口
let getCourseListApi = (params) => requests.post('/course/list', params);
// 新增课程
let addCourseApi = (params) => requests.post('/course/course', params);

// 查询题库列表
let getQuestionBankListApi = (params) => requests.post('/question/list_bank', params);
// 新增题库
let addQuestionApi = (params) => requests.post('/question/add_bank', params);

// 获取题库题目
let getQuestionListApi = (params) => requests.post('/question/list', params);
// 新增题目
let addQuestionApi1 = (params) => requests.post('/question/add', params);

// 系统用户信息列表
const queryUserListApi = (params) => requests.post('/user/list', params);


// 查看课程中的学生
let queryCourseStudentListApi = (params) => requests.post('/course/list_student', params);
// 课程中添加学生
let addCourseStudentApi = (params) => requests.post('/course/add_student', params);

// 查看作业列表
let getHomeworkListApi = (params) => requests.post('/work/list_teacher', params);
// 查看学生作业列表

let getStudentHomeworkListApi = (params) => requests.post('/work/list_student', params);
// 添加作业
let addHomeworkApi = (params) => requests.post('/work/add', params);
// 发布作业
let publishHomeworkApi = (params) => requests.post('/work/release', params);
// 预览作业
let previewHomeworkApi = (params) => requests.post('/work/view', params);
// 学生答题
let studentAnswerApi = (params) => requests.post('/work/submit_work', params);
// 老师作业情况列表
let getTeacherHomeworkListApi = (params) => requests.post('/work/list_record_teacher', params);

// 首页接口
// 老师
// 统计首页顶部的数据
let getStatisticsTopApi = (params) => requests.get('/home/teacher_show_head', { params });
// 左边的列表
let getStatisticsLeftApi = (params) => requests.get('/home/teacher_show_list', { params });
// 右边的表格
let getStatisticsRightApi = (params) => requests.get('/home/teacher_show_chart', { params });
// 学生
// 学生首页头部
let getStudentStatisticsTopApi = (params) => requests.get('/home/student_show_head', { params });
// 学生左边的列表
let getStudentStatisticsLeftApi = (params) => requests.get('/home/student_show_list', { params });
// 学生右边的表格
let getStudentStatisticsRightApi = (params) => requests.get('/home/student_show_chart', { params });
// 管理员
// 管理员首页接口
const getAdminStatisticsApi = (params) => requests.get('/home/admin_show', { params });
// 学生列表
const queryStudentListApi = (params) => requests.post('/course/student_list', params);

// 管理员查看作业情况

const getAdminHomeworkListApi = (params) => requests.post('/work/work_info', params);
// 管理员查看老师发布作业情况

const getAdminTeacherHomeworkListApi = (params) => requests.post('/work/work_teacher_info', params);
// 管理员查看学生完成情况

const getAdminStudentHomeworkListApi = (params) => requests.post('/work/work_student_info', params);
// 管理员成绩列表

const getAdminScoreListApi = (params) => requests.post('/work/grade_allList_info', params);



// 删除题目

let deleteQuestionApi = (id) => requests.post('/question/delete', { id });
// 编辑题目

let editQuestionApi = (id, params) => requests.post('/question/update', { id, ...params });
//删除课程中的学生

let deleteCourseStudentApi = (id) => requests.post('/course/del_student', { id });
// 删除作业

let deleteHomeworkApi = (id) => requests.post('/course/del_work', { id });



// 删除用户

let deleteUserApi = (id) => requests.post('/user/delete', { id });
// 编辑用户信息

let editUserApi = (id, params) => requests.post('/user/update', { id, ...params });
// 批改自定义作业

let editHomeworkApi = (id, score) => requests.post('/work/correct', { workRecordId: id, score });
// 重做作业

let redoHomeworkApi = (id) => requests.post('/work/redo', { workRecordId: id });
// 添加用户

let addUserApi = (params) => requests.post('/user/add', params);
// 修改用户信息

let editUserApi1 = (id, params) => requests.post('/user/update', { id, ...params });

// 系统登录信息
let loginLecords = (params) => requests.post('/user/login_records', params);

// 学生找老师聊天的列表
let teacherListApi = (params) => requests.post('/course/teacher_list', params);
// 查看聊天记录

let getChatListApi = (params) => requests.post('/business/query_char_rec', params);
// 发送消息

let sendMessageApi = (params) => requests.post('/business/send_chat', params);

// 修改密码

let editPasswordApi = (id, params) => requests.post('/user/update_pass_word', { id, ...params });

// 获取个人用户信息

let getUserInfoByIdApi = (params) => requests.post('/user/get_user_info', { id: params });
export {
    goLogin,
    goRegister,
    getUserInfoApi,
    getCourseListApi,
    addCourseApi,
    getQuestionBankListApi,
    addQuestionApi,
    getQuestionListApi,
    addQuestionApi1,
    queryUserListApi,
    queryCourseStudentListApi,
    addCourseStudentApi,
    getHomeworkListApi,
    addHomeworkApi,
    publishHomeworkApi,
    previewHomeworkApi,
    getStudentHomeworkListApi,
    studentAnswerApi,
    getTeacherHomeworkListApi,
    getStatisticsTopApi,
    getStatisticsLeftApi,
    getStatisticsRightApi,
    getStudentStatisticsTopApi,
    getStudentStatisticsLeftApi,
    getStudentStatisticsRightApi,
    getAdminStatisticsApi,
    queryStudentListApi,
    getAdminHomeworkListApi,
    getAdminTeacherHomeworkListApi,
    getAdminStudentHomeworkListApi,
    getAdminScoreListApi,
    deleteQuestionApi,
    editQuestionApi,
    deleteCourseStudentApi,
    deleteHomeworkApi,
    deleteUserApi,
    editUserApi,
    editHomeworkApi,
    redoHomeworkApi,
    addUserApi,
    editUserApi1,
    loginLecords,
    teacherListApi,
    getChatListApi,
    sendMessageApi,
    editPasswordApi,
    getUserInfoByIdApi
}